//
//  OrderStarCell.m
//  PigMarket
//
//  Created by 张敬 on 2019/9/12.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "OrderStarCell.h"

@implementation OrderStarCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self setupContent];
    }
    return self;
}


- (void)setupContent{
    
    [self addSubview:self.textLab];
    [self addSubview:self.ratingView];
    
}


- (void)layoutSubviews{
    [super layoutSubviews];
    
    _textLab.mj_x = 15;
    _textLab.mj_y = 23;
    
    _ratingView.mj_x = 92;
    _ratingView.mj_y = _textLab.mj_y - 8;
    
}

#pragma mark - delegate
- (void)ratingView:(LHRatingView *)view score:(CGFloat)score{
    
    if (self.cellScoreBlock) {
        self.cellScoreBlock(score);
    }
}

#pragma mark - setter and getter

- (UILabel *)textLab{
    if (!_textLab) {
        _textLab = [[UILabel alloc] init];
        _textLab.font = mFont(13);
        _textLab.text = @"商品质量";
        _textLab.size = CGSizeMake(60, 18);
        _textLab.textColor = UIColorFromRGB(0x666666);
    }
    return _textLab;
}


- (LHRatingView *)ratingView{
    
    if (!_ratingView) {
        _ratingView = [[LHRatingView alloc] initWithFrame:CGRectMake(0, 0, 140, 30)];
        _ratingView.delegate = self;
        _ratingView.ratingType = INTEGER_TYPE;
        //widDistance
        _ratingView.widDistance = [self fitSize:9];
    }
    
    return _ratingView;
}


@end
